package edu.gdkm.demo12;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class CourseManager {
    //Set是无序集合，集合中元素不能重复
    Set<Course> hashSet = new HashSet();
    public void addCourse(Course course){
        hashSet.add(course);
    }
    public void removeCourse(Course course){
        hashSet.remove(course);
    }
    public void listAllCourse(){
//        //for增强循环
//        for(Course course:hashSet){
//            System.out.println(course);
//        }
        Iterator<Course> it=hashSet.iterator();
        System.out.println("****************************************************");
        while(it.hasNext()){

            System.out.println(it.next());
        }
        System.out.println("****************************************************");
    }
}
